package com.tian.print.http.interceptor;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Response;

/**
 * Description: 响应拦截器 比如缓存响应头信息
 * <br>Author：tian
 * <br>Time: 2019/5/24 14:11
 */
public class ResponseInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        //比如
        Response response = chain.proceed(chain.request());
        //存入Session
        if (response.header("Set-Cookie") != null) {
//            SessionManager.setSession(response.header("Set-Cookie"));
        }
        //刷新API调用时间
//        SessionManager.setLastApiCallTime(System.currentTimeMillis());

        return response;

    }
}
